/**
 * 
 */
package com.study.builder;

import lombok.Data;
import lombok.ToString;

/**
 * @author Administrator
 * @date 2019年5月8日
 */
@Data
@ToString
public class Person {

	/**
	 * @param builder
	 */
	public Person(Builder builder) {
		name = builder.name;
		age = builder.age;
	}

	private String name;
	private int age;
	
	public static class Builder{
		private String name;
		private int age;
		
		public Builder name(String n){
			name = n;
			return this;
		}
		public Builder age(int a){
			age = a;
			return this;
		}
		public Person build(){
			return new Person(this);
		}
	}
}
